package cn.jg.framework.auth.model;

import cn.jg.framework.common.model.SimpleBaseMultiTenantModel;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.common.collect.Lists;
import lombok.*;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false, exclude = "userList")
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Position extends SimpleBaseMultiTenantModel {

    private static final long serialVersionUID = 1L;

    private Position parent;

    private String parentIds;

    private String parentId;

    private String name;

    private List<User> userList = Lists.newArrayList();

    public boolean isTop() {
        return null != this.parentIds && this.parentIds.equals("0,");
    }

}